const express = require('express');
const { routeWrapper } = require('../../../lib/module/tool/route');
const router = express.Router();

const productCategoryService = require('../../../lib/service/productCategoryService');

// 删除产品分类对应关系（删除商品时删除）
router.delete('/:productId/deleteProductCategory', routeWrapper(async (req) => {
    return productCategoryService.deleteProductCategory(req.params.productId);
}, true));

// 增加对应关系
router.post('/:areaId/insertProductCategory', routeWrapper(async (req) => {
    return productCategoryService.InsertProductCategory(req.params.areaId, req.body.productId, req.body.categoryList);
}, true));

// 删除产品分类对应关系在（编辑产品时删除关系）
router.delete('/delete/productCategoryContact', routeWrapper(async (req) => {
    return productCategoryService.ProductCategoryContact(req.body.contactListId);
}, true));

module.exports = router;
